#include <iostream>
using namespace std;

int l[10000], i = 0;

int main(){
    cin >> l[i];

    while (l[i] != 1)
    {
        i++;
        if (l[i-1] % 2 == 0) l[i] = l[i-1]/ 2;
        else l[i] = l[i-1] * 3 + 1;

    }
    for (i; i >= 0; i--) {
        cout << l[i] << " ";
    }
}
